package com.resou.reader.mine.vipcenter.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.resou.reader.api.ApiConstant;
import com.resou.reader.api.entry.PrivilegeBean;

import java.util.List;

import com.resou.reader.R;
import com.resou.reader.assist.WebActivity;
import com.resou.reader.data.vip.model.VipPrivilege;

/**
 * Author: 萤火虫
 * E-mail:  Allensuns@163.com
 * Description:
 * CreateTime: 2019-04 -16
 **/
public class VipCenterAdapter extends BaseQuickAdapter<VipPrivilege.PrivilegeDataBean, BaseViewHolder> {

    public VipCenterAdapter(int layoutResId, @Nullable List<VipPrivilege.PrivilegeDataBean> data) {
        super(layoutResId, data);
    }

    public VipCenterAdapter(@Nullable List<VipPrivilege.PrivilegeDataBean> data) {
        super(data);
    }

    @Override
    protected void convert(BaseViewHolder helper, VipPrivilege.PrivilegeDataBean item) {
        helper.setText(R.id.tvLabel, item.getName());
        Glide.with(mContext).load(item.getUrl() + "").into((ImageView) helper.getView(R.id.ivIcon));
        LinearLayout linearLayout = helper.getView(R.id.llOnclickPrivilege);
        linearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                WebActivity.startActivity(mContext, ApiConstant.VIPGUIDE, "VIP尊享特权");
            }
        });
    }
}
